<template>
  <div class="mod-config">
    <basic-container>
      <div class="boxsty zhiBiao">
        <div class="flex justifyContentSpaceBetween mb10">
          <div class="tabletext">我的待办审核</div>
        </div>
        <el-table :data="dataList" height="70vh" style="min-height: 100px;" border>
          <el-table-column label="审批编号" prop="ywMainCode" align="center" min-width="120px"></el-table-column>
          <el-table-column label="审批名称" prop="ywTitle" header-align="center" align="center" min-width="250px"></el-table-column>
          <el-table-column label="当前节点" prop="taskName" align="center" width="120px"></el-table-column>
          <el-table-column label="发起人" prop="fqRyName" align="center" width="120px"></el-table-column>
          <el-table-column label="接收时间" prop="ksTime" align="center" width="150px" show-overflow-tooltip>
            <template slot-scope="scope">{{$moment(scope.row.ksTime).format("YYYY-MM-DD HH:mm")}}</template>
          </el-table-column>
          <el-table-column label="操作" align="center" min-width="100">
            <template slot-scope="scope">
              <!--            <el-button  type="primary" plain @click="handleDialog(scope.row)">审批办理</el-button>-->
              <el-button  type="primary" plain @click="tzDialog(scope.row)">审核</el-button>

            </template>
          </el-table-column>
        </el-table>
      </div>

      <div class="avue-crud__pagination">
        <el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex"
                       :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" :total="totalPage" background
                       layout="total, sizes, prev, pager, next, jumper">
        </el-pagination>
      </div>
<!--      <workflow ref="workflow" @refreshDataList="getDataList"></workflow>-->
      <tz ref="tz"></tz>
    </basic-container>
  </div>
</template>

<script>
import {wddbpage} from "@/api/workflow/wfywmain";
import workflow from '@/views/workflow/apply/index'
import tz from '@/views/jiangjin/jiangjinjjsh/form'

import store from '@/store'
import {
  mapGetters
} from 'vuex'

export default {
  data() {
    return {
      dataForm: {
        key: ''
      },
      dataFormSzbg: {
        id: 0,
        szbgFjmc: '',
        szbgFjlx: '',
        szbgFjdz: '',
        szJzDate: ''
      },
      bgdialogVisible: false,
      dataList: [
        {
          ywMainCode:"2021-0000001",
          ywTitle:'2021年上半年奖励',
          taskName:'领导审核',
          fqRyName:'发起人',
          ksTime:"2021-09-01 00:00:00",
        },
        // {
        //   ywMainCode:"2021-0000002",
        //   ywTitle:'审批二',
        //   taskName:'节点二',
        //   fqRyName:'发起人二',
        //   ksTime:"2021-09-02 00:00:00",
        // },
        // {
        //   ywMainCode:"2021-0000003",
        //   ywTitle:'审批三',
        //   taskName:'节点三',
        //   fqRyName:'发起人三',
        //   ksTime:"2021-09-03 00:00:00",
        // },
        // {
        //   ywMainCode:"2021-0000004",
        //   ywTitle:'审批四',
        //   taskName:'节点四',
        //   fqRyName:'发起人四',
        //   ksTime:"2021-09-04 00:00:00",
        // },
      ],
      pageIndex: 1,
      pageSize: 10,
      totalPage: 0,
      dataListLoading: false,
      addOrUpdateVisible: false,
      cepinghdgulszbgUploadFormVisible: false,
      headers: {
        Authorization: 'Bearer ' + store.getters.access_token
      },
      bgUrl: ""
    }
  },
  created() {
    // this.getDataList();
  },
  computed: {
    ...mapGetters(['permissions'])
  },
  props: {
    tableHeight: {
      type: String,
      default: null
    }
  },
  components: {
    workflow,
    tz
  },
  methods: {
    formater(row, column, cellValue, index) {
      if (cellValue) {
        return this.$moment(cellValue).format("yyyy-MM-DD HH:mm");
      } else {
        return cellValue;
      }
    },
    // 获取数据列表 预览分页查询使用
    getDataList() {
      this.dataListLoading = true
      wddbpage(Object.assign({
        current: this.pageIndex,
        size: this.pageSize
      })).then(response => {
        this.dataList = response.data.data.records
        this.totalPage = response.data.data.total
      })
      this.dataListLoading = false
    },
    // 每页数
    sizeChangeHandle(val) {
      this.pageSize = val
      this.pageIndex = 1
      this.getDataList()
    },
    // 当前页
    currentChangeHandle(val) {
      this.pageIndex = val
      this.getDataList()
    },
    handleDialog(r) {
      this.$refs.workflow.open(r.ywId)
    },
    //跳转
    tzDialog(r) {
      this.$refs.tz.init(r.ywId)
    }
  }
}

</script>
